<?php $this->load->view('partial/head'); ?>

<script>
$(function(){
	$('.dataTables').dataTable();
});
</script>

<h1>Petugas</h1>

<a href="<?=base_url()."index.php/admin/add_petugas"?>" style="margin-bottom: 20px; display: block">Tambah Petugas</a>

<?php if($pesan != NULL){
	echo "<div class='form-info ".($pesan['success'] ? 'success' : 'fail')."'>".$pesan['pesan']."</div>";
} ?>

<table class="dataTables" cellspacing="0" width="100%">
	<thead>
		<tr>
			<th width="5%">No.</th>
			<th>Nama</th>
			<th>No. Telfon</th>
			<th>Role</th>
			<th>Aksi</th>
		</tr>
	</thead>
	<tbody>
		<?php $no= 1; foreach($petugas as $petugas){ ?>
			<tr>
				<td><?=$no?></td>
				<td><?=$petugas['nama']?></td>
				<td><?=$petugas['no_telp']?></td>
				<td><?=$role[$petugas['role']]?></td>
				<td>
					<a href="<?=base_url()."index.php/admin/edit_petugas/".$petugas['id_petugas']?>">Edit</a> |
					<a href="<?=base_url()."index.php/admin/delete_petugas/".$petugas['id_petugas']?>">Hapus</a>
				</td>
			</tr>
		<?php $no++; } ?>
	</tbody>
</table>